﻿using LokiProvider;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace Microsoft.Extensions.Logging;

public static class LokiLoggerExtensions
{

    public static ILoggingBuilder AddLoki(this ILoggingBuilder builder)
    {
        return builder.AddLoki(static config => { });
    }
    public static ILoggingBuilder AddLoki(this ILoggingBuilder builder, Action<LokiLoggerOptions> configure)
    {
        builder.Services.Configure(configure);
        builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, LokiLoggerProvider>());
        return builder;
    }
}